package com.opennice.tools;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;


public class ExportDB {


	public static void main(String[] args) {
			Configuration cfg = new Configuration().configure();
		    //SchemaExport export = new SchemaExport(cfg);
		    SchemaExport export = new SchemaExport(new AnnotationConfiguration()
		     .configure());
		    
			export.create(true, true);
			System.out.println("Table created.");
		    SessionFactory sessionFactory = cfg.buildSessionFactory();
		    Session session = sessionFactory.openSession();
		    Transaction  tx = session.beginTransaction();
		    
		    
		    tx.commit();
		    session.close();
	}
	}